#pragma once

#include "IWriter.hpp"
#include "IWriteStrategy.hpp"
#include "NormalStrategy.hpp"
#include "LazyStrategy.hpp"
#include "Observable.hpp"
#include <iostream>
#include <string>

class CFileWriter : public IWriter,public Observable{
public:
    CFileWriter(const std::string& filename);
    CFileWriter() = delete;
    ~CFileWriter();
    CFileWriter(const CFileWriter&) = delete;
    CFileWriter& operator=(const CFileWriter&) = delete;
    CFileWriter(const CFileWriter&&) = delete;
    CFileWriter& operator=(const CFileWriter&&) = delete;
    // IWrite Interface
    int WriteAtBegin(void* data,int length) override;
    int WriteAt(int pos,void* data,int length)override;
    int WriteEnd(void* data,int length) override;
private:
    struct FileWriterImpl;
    FileWriterImpl * m_pImpl;
    // std::string m_filename;
    IWriteStrategy * m_pStrategy = nullptr;

};